var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');

var app = express();
// 引入ejs
let ejs =require("ejs")
// 引入首页
var index=require(__dirname+"/routes/index.js")
// 引入增加页
var add=require(__dirname+"/routes/add.js")
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

// 配置引擎
app.set("view engine", "html")
app.set("views",__dirname+"/views")
app.engine("html",ejs.__express)


// 加载路由层页面
app.use(index)
app.use(add)


module.exports = app;
